package org.aplombh.java.interview.newcoder;

import java.util.ArrayList;
import java.util.Scanner;

public class HJ17_坐标移动 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String str = in.nextLine();
            String[] split = str.split(";");
            int x = 0, y = 0;
            for (String s : split) {
                if (check(s)) {
                    if (s.charAt(0) == 'A') x -= Integer.parseInt(s.substring(1));
                    if (s.charAt(0) == 'S') y -= Integer.parseInt(s.substring(1));
                    if (s.charAt(0) == 'W') y += Integer.parseInt(s.substring(1));
                    if (s.charAt(0) == 'D') x += Integer.parseInt(s.substring(1));
                }
            }
            System.out.println(x + "," + y);
        }
    }

    private static boolean check(String s) {
        if (s.isEmpty())
            return false;
        if (s.length() > 3)
            return false;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) > '9' || s.charAt(i) < '0')
                return false;
        }
        return true;
    }
}